<?php
require_once("include/setup.php");
require_once(CLASS_PATH.'document.class.php');
LoginHelper::controlAccess(array('type_droits_user' => '>=1'));

$id = $_REQUEST['id'];
$document = new Document($id);
if (!empty($document->id_document)) {
	header('Content-Type: application/octet-stream');
	header('Content-Disposition: attachment;filename="'.$document->filename.'"');
	@readfile("files/documents/".$document->filepath);
}
?>